﻿@{
    ViewBag.Title = "Home";
}

<html>
<head>
    <meta name="viewport" content="width=device-width" />
</head>
<body>
    <h2><a href="/Home/Index">首页</a></h2>
    <h1 style="text-align:center">图书信息管理列表</h1>
    <div style="text-align:center;border:1px solid black;background-color:lightgray;">
        <table style="margin:0px auto;">
            <tr>
                <td style="width:200px">
                    <p>书名</p>
                </td>
                <td style="width:150px">
                    <p>作者</p>
                </td>
                <td style="width:200px">
                    <p>版设</p>
                </td>
                <td style="width:150px">
                    <p>价格</p>
                </td>
                <td style="width:100px">
                    <p>类型</p>
                </td>
                <td>
                    <p style="width:100px">修改信息</p>
                </td>
                <td>
                    <p style="width:100px">上/下架</p>
                </td>
                <td>
                    <a href="/Admin/Create">添加图书</a>
                </td>

            </tr>
            @foreach (var books in ViewBag.books)
            {
                <tr>
                    <td>@books.bookname</td>
                    <td>@books.Author</td>
                    <td>@books.Press</td>
                    <td>@books.Price</td>
                    <td>@books.Type</td>
                    <td><a href="/Admin/update/?id=@books.ID">修改信息</a></td>
                    @if (books.Show==1) 
                    {
                        <td><a href="/Admin/dalete/?id=@books.ID">下架</a></td>
                    }else
                    {
                        <td><a href="/Admin/insert/?id=@books.ID">上架</a></td>
                    }

                </tr>
            }
        </table>
    </div>
</body>
</html>
